home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6942 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: solon.com!not-for-mail
  2. From: atk@mathcs.emory.edu (Alan Krantz)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: Can someone tell me why C can't support the following
  5. Date: 16 Feb 1996 09:26:29 -0600
  6. Organization: Emory University, Dept of Math and CS
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4g27n5$qa4@solutions.solon.com>
  10. NNTP-Posting-Host: solutions.solon.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13.  
  14. I know the following is illegal but I would really really like to know
  15. why C can't support the following construct:
  16.  
  17. typedef struct _mytbl {
  18.   char  *str;          ; Leagal
  19.   int   *data;         ; Illegal (see below)
  20. } mytbl[] = {"Not Defined", {0},
  21.              "Square",      {1,2,3,4,0},
  22.              "Circle",      {1,2,0},
  23. };
  24.  
  25. Note1: I want data to point to an array of integer who's length is determined
  26. by a {} list. I could do something silly like "int data[10]" and assume all
  27. lists have 10 or fewer elements. 
  28.  
  29. NOTE2:  I am NOT asking the compiler to generate a variable size structure
  30. called mytbl where data varies in size. I AM asking it to allocate a vector
  31. of integer and assign the address of that integer to data. Wouldn't this be
  32. a nice feature....
  33.  
  34. Well send reasons why this is bad (and flames) to atk@cs.colorado.edu since
  35. I don't read the news group!
  36.  
  37.  
  38. --
  39. Alan Krantz
  40. atk@mathcs.emory.edu         
  41. Emory University, Atlanta, GA 
  42.